import Vue from 'vue'
import App from './App.vue'
import router from './router'
import './plugins/element.js'

//引入全局样式
import '@/assets/global.css'
//引入全局字体图标
import '@/assets/fonts/iconfont.css'
//引入axios
import axios from 'axios'

//设置请求的根路径
axios.defaults.baseURL = 'http://106.54.194.45:8888/api/private/v1/'
Vue.prototype.$http = axios

//请求拦截器的配置  (固定写法)
axios.interceptors.request.use(config => {
  config.headers.Authorization = window.sessionStorage.getItem('token')
  //最后必须return  一个config  固定写法
  return config
})

Vue.config.productionTip = false
Vue.use(axios)

new Vue({
  router,
  render: h => h(App)
}).$mount('#app')
